<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/11/1
  Time: 16:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="java.lang.*" %>
<%@ page language="java" import="java.io.*" %>
<%@ page language="java" import="com.wsu.search.tools.Tools" %>
<%@ page language="java" import="com.limao.Tool.CacheClass" %>
<%@ page import="com.limao.DBDataClass.SysProjectCateDataClass" %>
<%@ page import="com.limao.CacheManager.CrowdSysCateCache" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<head>
    <base href="<%=basePath %>"/>
</head>

<%
    /*
     网站首页生成程序
     */

    //取得url带过来的参数
    String params = Tools.RmNull(request.getParameter("cateid"));

    /* ************读写模板文件操作**************** */

    // 读模板,先判断此信息最终极分类有没有,没有读t_type c_belong根栏目分类模板,还没有读news_info.html资讯类默认模板
    String filename = request.getRealPath("/model/mod_classification_mb.html");
    System.out.println(filename);
    File fileobj = new File(filename);

    if (!fileobj.exists()) {
        // 如果模板文件找不到
        out.println("<font color=red>出错了,模板mod_classification_mb.html文件找不到或丢失!</font>");
        return;
    }
    StringBuffer strb = Tools.readFile(filename);

    /* ************ start input data **************** */
    // 先调 用接口取得众筹分类列表数据
    List<SysProjectCateDataClass> catlist = CrowdSysCateCache.getInstance().loadProjectCateJson();
    // 增加 全部
    SysProjectCateDataClass catAll = new SysProjectCateDataClass();
    catAll.cateid = "0";
    catAll.catename = "全部";
    catlist.add(catAll);
    //数据与样式进行结合，组装
    String tmpStr = "";
    for (int i = 0; i < catlist.size(); i++) {
        SysProjectCateDataClass cat = catlist.get(i);

        tmpStr = tmpStr + "<a href=\"#\">" + cat.catename + "</a>";
    }

    strb = Tools.replaceAll(strb, "[众筹分类列表]", tmpStr);

    /* ************* end input data **************** */


    out.println(strb);
    strb = null;
%>
